<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改偏差分析')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none;
    }

    input[type="number"] {
        -moz-appearance: textfield;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-deviationAnalysis-edit">
        <input type="hidden" name="id" th:value="${deviationAnalysis.id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">工程公司：</label>
            <div class="col-sm-8">
                <input type="hidden" name="companyId" th:value="${deviationAnalysis.companyId}">
                <input class="form-control" type="text" name="companyName" th:value="${deviationAnalysis.compName}"
                       readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">项目名称：</label>
            <div class="col-sm-8">
                <input type="hidden" name="proId" th:value="${deviationAnalysis.proId}">
                <input class="form-control" type="text" name="proName" th:value="${deviationAnalysis.proName}" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">年份：</label>
            <div class="col-sm-8">
                <select name="years" class="form-control">
                    <option value="">请选择</option>
                    <option th:each="years : ${years}" th:text="${years.years}+'年'"
                            th:value="${years.years}" th:selected="${years.years==deviationAnalysis.years}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">月份：</label>
            <div class="col-sm-8">
                <select name="months" class="form-control">
                    <option value="">请选择</option>
                    <option th:each="months : ${months}" th:text="${months.monthInYear}+'月'"
                            th:value="${months.monthInYear}"
                            th:selected="${months.monthInYear==deviationAnalysis.months}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">楼栋：</label>
            <div class="col-sm-8">
                <select id="buildId" name="buildId" class="form-control m-b">
                    <option value="">请选择</option>
                    <option th:each="build : ${build}" th:text="${build.buildName}"
                            th:value="${build.buildId}" th:selected="${build.buildId==deviationAnalysis.buildId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">类型：</label>
            <div class="col-sm-8">
                <select name="type" th:with="importantType=${@dict.getType('importantType')}" class="form-control">
                    <option th:each="importantType : ${importantType}" th:text="${importantType.dictLabel}"
                            th:value="${importantType.dictValue}"
                            th:selected="${importantType.dictValue==deviationAnalysis.type}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">原因：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="reason" placeholder="请输入原因"
                       th:value="${deviationAnalysis.reason}">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script>
    var prefix = ctx + "deviationAnalysis";

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-deviationAnalysis-edit").serializeArray();
            $.operate.save(prefix + "/edit", data);
        }
    }
</script>
</body>
</html>